import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class DataHistory {
  //当前时间
  late String currentTime;

  //时间差值
  late String dTime;

  //秒表
  late String stopWatchTime;

  // 构造函数
  DataHistory(this.currentTime, this.dTime, this.stopWatchTime);

  @override
  String toString() {
    return currentTime + "\t" + dTime + "\t" + stopWatchTime;
  }

  RichText transToRichText(int index) {
    return RichText(
      text: TextSpan(children: [
        TextSpan(
            text: ((index + 1) < 10 ? "00" : ((index + 1) < 100 ? "0" : "")) +
                (index + 1).toString() +
                "." +
                currentTime,
            style: const TextStyle(color: Colors.black)),
        TextSpan(
            text: " 时间差" + dTime, style: const TextStyle(color: Colors.amber)),
        TextSpan(
            text: " 秒表" + stopWatchTime,
            style: const TextStyle(color: Colors.indigoAccent))
      ]),
    );
  }
}
